import java.io.Serializable;


@SuppressWarnings("serial")
public class Player implements MatchNode, Serializable {
	
	private int id;
	private int depth = 1;
	private String name;
	private int playLv;
	
	
	public Player(int id, String name) {
		this.id = id;
		this.name = name;
		playLv = 1;
	}

	public Player(int id, String name, int playLv) {
		this.id = id;
		this.name = name;
		this.playLv = playLv;
	}
	
	public String getInfo(DrawLevel lv) {
		String result = "";
		switch(lv) {
		case DRAW_NAME:
			result = String.format("%s",name);
			break;
		case DRAW_NAMELEVEL:
			result = String.format("%s(Lv:%d)",name,playLv);
			break;
		case DRAW_DEBUG:
			result = String.format("%s(Lv:%d,id:%d,dep:%d)",name,playLv,id,depth);
			break;
		default:
			result = String.format("%s",name);
		}
	
		return result; 
	}

	public String toString() {
		return toString(DrawLevel.DRAW_NAME);
	}
	
	public String toString(DrawLevel level) {
		String result = "";
		
		result = String.format("%s%15s",getIndent(),getInfo(level));
		
		return result;		
	}
	
	public String getIndent() {
		String indent = "";
		
		for(int i=0;i<depth;i++) {
			indent += Match.DRAW_INDENT;
		}
		
		return indent; 
	}
	
	public int getDepth() {
		return depth;
	}
	
	public void calcDepth(int d) {
		depth = d - 1;
	}
	
	public int getId() {
		return id;
	}
	
	public MatchNode getWinnerNode() {
		return this;
	}
}
